#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int *copy(const int *src)
{
    if (src == NULL)
    {
        return NULL;
    }

    // 计算数组长度
    size_t length = 0;
    while (src[length] != -1)
    {
        length++;
    }

    // 分配新的内存
    int *dest = (int *)malloc((length + 1) * sizeof(int));
    if (dest == NULL)
    {
        fprintf(stderr, "内存分配失败\n");
        return NULL;
    }

    // 拷贝数据
    memcpy(dest, src, (length + 1) * sizeof(int));

    return dest;
}
void findCombinations(int n, int *nums, int tar, int start, int *current, int *returnSize, int presum, int results[][100])
{

    if (presum + nums[start] > tar)
        return;

    if (presum + nums[start] == tar)
    {

        int i;
        for (i = 0; current[i] != 0; i++)
        {
            results[*returnSize][i] = current[i];
        }
        results[*returnSize][i] = nums[start];
        (*returnSize)++;
        return;
    }
    int *current1 = copy(current);
    for (int i = 0; i < n; i++)
        if (current1[i] == 0)
        {
            current1[i] = nums[start];
            break;
        }

    for (int i = start + 1; i <= n; i++)
    {
        findCombinations(n, nums, tar, i, current1, returnSize, presum + nums[start], results);
    }
    free(current1);
}
int main()
{
    int n, nums[110] = {0}, tar, results[100][100], returnsize, current[100];
    scanf("%d %d", &n, &tar);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", nums + i);
    }
    findCombinations(n, nums, tar, 0, current, &returnsize, 0, results);
    printf("%d\n", returnsize);int j;
    for (int i = 0; i < returnsize; i++)
    {
        for ( j= 0; results[i][j+1] != 0; j++)
        {
            printf("%d ", results[i][j]);
        }
        printf("%d", results[i][j]);
        printf("\n");
    }
}